<!DOCTYPE HTML>
#("#@meta(keywords??'无', description??'无')")
<body>
<article class="cl pd-20">
    #set(adminAdd = "/admin")
    <form action="#(adminAdd)/#(table.entityPath)/#('#if(!'+table.entityPath +'.id??)'+'save #else update #end')" method="post" class="form form-horizontal" id="form-admin-add">
        #for(field : table.fields)
        #if(field.propertyName == "id")
        <input type="hidden" class="input-text" value="#('#('+table.entityPath +'.' + field.propertyName +'??)')" placeholder="#(field.comment)" id="#(field.propertyName)" name="#(field.propertyName)" />
        #elseif(field.propertyName != "gmtCreate" && field.propertyName != "gmtModified")
        <div class="row cl">
            <label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>#(field.comment)：</label>
            <div class="formControls col-xs-8 col-sm-9">
                <input type="text" class="input-text" #if(field.type == "datetime") onfocus="WdatePicker()" autocomplete="off" value="#("#date(")#(table.entityPath)#(".")#(field.propertyName)#("??,")#("'yyyy-MM-dd HH:mm:ss'")#(')')" #else value="#('#('+table.entityPath +'.' + field.propertyName +'??)')" #end  placeholder="#(field.comment)" id="#(field.propertyName)" name="#(field.propertyName)">
            </div>
        </div>
        #end
        #end
        <div class="row cl">
            <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
            </div>
        </div>
    </form>

</article>

<!--_footer 作为公共模版分离出去-->
#("#@footer()")
<!--/_footer /作为公共模版分离出去-->
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">
    /**
     * layer.msg icon 图片样式
     * 1 绿色打 √
     * 2 红色打 X
     * 3 橙色 ？
     * 4 灰色锁头
     * 5 红色哭脸
     * 6 绿色笑脸
     * 7 黄色 !
     */
    $(function(){
        //单选框和复选框优化样式，具体参照文档
    /* $('.skin-minimal input').iCheck({
            checkboxClass: 'icheckbox-blue',
            radioClass: 'iradio-blue',
            increaseArea: '20%'
        });*/

        $("#form-admin-add").validate({
            rules:{
            #for(field : table.fields)
                #(field.propertyName):{
                    required:true,
                }#if(!for.last),#end
            #end
            },
            onkeyup:false,
            focusCleanup:true,
            success:"valid",
            submitHandler:function(form){
                $(form).ajaxSubmit({
                    success:function(data){
                        if (data.status == 0){
                            layer.msg("成功", {icon:1,time:1000}, function(){
                                parent.document.getElementById("btn-refresh").click();
                            });
                        } else {
                            layer.msg(data.msg, {icon:2,time:1000});
                        }

                    },
                    error:function(data){
                        layer.msg("系统错误" + data.responseText,{icon:5,time:1000});
                    }
                });
                return false;
            }
        });
    });

</script>
<!--/请在上方写此页面业务相关的脚本-->
</body>
</html>